﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;

namespace HCQ2_Model.VRQDMeta.InputDto._20220112
{
    /// <summary>
    ///  审核应用商品信息
    /// </summary>
    public class CheckMetaAppInput
    {
        /// <summary>
        ///  审批意见
        /// </summary>
        public string approveNote { get; set; }
        /// <summary>
        ///  应用缩略图在文件服务器的访问地址
        /// </summary>
        [Required(ErrorMessage = "imageUrl必传！")]
        public string imageUrl { get; set; }
        /// <summary>
        ///  用户编码
        /// </summary>
        [Required(ErrorMessage = "用户编码必传！")]
        public string userid { get; set; }
        /// <summary>
        ///  应用商品ID
        /// </summary>
        public int fileID { get; set; }
        /// <summary>
        ///  名称
        /// </summary>
        [Required(ErrorMessage = "名称必传！")]
        public string fileName { get; set; }
        /// <summary>
        ///  简介
        /// </summary>
        public string fileNote { get; set; }
        /// <summary>
        ///  所属目录ID
        /// </summary>
        [Required(ErrorMessage = "所属目录ID必传！")]
        [RegularExpression("^([1-9][0-9]*)$", ErrorMessage = "请正确输入所属目录ID")]
        public int folderID { get; set; }
        /// <summary>
        ///  状态（通过或拒绝）【通过=5，不通过=6】
        /// </summary>
        [Required(ErrorMessage = "状态必传！")]
        [RegularExpression("^(5|6)$", ErrorMessage = "请正确输入状态值")]
        public int fileStatus { get; set; }

        /// <summary>
        /// 转T_DocumentInfo实体
        /// </summary>
        /// <returns></returns>
        public T_DocumentInfo ToDocInfoEntity(T_DocumentInfoLog log)
        {
            return new T_DocumentInfo
            {
                file_id = log.file_id,
                file_name = log.file_name,
                file_note = log.file_note,
                pag_num = log.pag_num,
                finish_time = log.finish_time,
                attach_url = log.attach_url,
                image_url = log.image_url,
                doc_number = log.doc_number,
                file_size = log.file_size,
                create_name = log.create_name,
                create_id = log.create_id,
                create_time = log.create_time,
                update_name = log.update_name,
                update_time = log.update_time,
                pro_type = log.pro_type,
                page_type = log.page_type,
                isEntity = log.isEntity,
                store_id = log.store_id,
                file_status = log.file_status,
                file_money = log.file_money,
                approve_time = DateTime.Now,
                approve_name = log.approve_name
            };
        }
    }
}